home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / empathy / empathy-log-manager.xsl < prev    next >
Text File  |  2009-10-29  |  4KB  |  149 lines

  1. <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
  2.  
  3.   <xsl:output method="html" encoding="utf-8" indent="yes"/>
  4.  
  5.   <xsl:template match="/">
  6.     <html>
  7.       <head>
  8.         <style type="text/css">
  9.           <xsl:text>
  10.             body {
  11.               background: #fff;
  12.           font-family: Verdana, "Bitstream Vera Sans", Sans-Serif; 
  13.           font-size: 10pt;
  14.             }
  15.             .stamp {
  16.               color: #999;
  17.             }
  18.             .top-day-stamp {
  19.               color: #999;
  20.               text-align: center;
  21.               margin-bottom: 1em;
  22.             }
  23.             .new-day-stamp {
  24.               color: #999;
  25.               text-align: center;
  26.               margin-bottom: 1em;
  27.               margin-top: 1em;
  28.             }
  29.             .nick {
  30.               color: rgb(54,100, 139);
  31.             }
  32.             .nick-self {
  33.               color: rgb(46,139,87);
  34.             }
  35.            .nick-highlight {
  36.               color: rgb(205,92,92);
  37.             }
  38.           </xsl:text>
  39.         </style>
  40.         <title><xsl:value-of select="$title"/></title>
  41.       </head>
  42.       <body>
  43.         <xsl:apply-templates/>
  44.       </body>
  45.     </html>
  46.   </xsl:template>
  47.  
  48.   <xsl:template name="get-day">
  49.     <xsl:param name="stamp"/>
  50.     <xsl:value-of select="substring ($stamp, 1, 8)"/>
  51.   </xsl:template>
  52.  
  53.   <xsl:template name="format-stamp">
  54.     <xsl:param name="stamp"/>
  55.     <xsl:variable name="hour" select="substring ($stamp, 10, 2)"/>
  56.     <xsl:variable name="min" select="substring ($stamp, 13, 2)"/>
  57.  
  58.     <xsl:value-of select="$hour"/>:<xsl:value-of select="$min"/>
  59.   </xsl:template>
  60.  
  61.   <xsl:template name="format-day-stamp">
  62.     <xsl:param name="stamp"/>
  63.     <xsl:variable name="year" select="substring ($stamp, 1, 4)"/>
  64.     <xsl:variable name="month" select="substring ($stamp, 5, 2)"/>
  65.     <xsl:variable name="day" select="substring ($stamp, 7, 2)"/>
  66.  
  67.     <xsl:value-of select="$year"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$day"/>
  68.   </xsl:template>
  69.  
  70.   <xsl:template name="header">
  71.     <xsl:param name="stamp"/>
  72.     <div class="top-day-stamp">
  73.       <xsl:call-template name="format-day-stamp">
  74.         <xsl:with-param name="stamp" select="@time"/>
  75.       </xsl:call-template>
  76.     </div>
  77.   </xsl:template>  
  78.  
  79.   <xsl:template match="a">
  80.     <xsl:text disable-output-escaping="yes"><a href="</xsl:text>
  81.  
  82.     <xsl:value-of disable-output-escaping="yes" select="@href"/>
  83.  
  84.     <xsl:text disable-output-escaping="yes">"></xsl:text>
  85.  
  86.     <xsl:value-of select="@href"/>
  87.     <xsl:text disable-output-escaping="yes"></a></xsl:text>
  88.   </xsl:template>
  89.  
  90.   <xsl:template match="log">
  91.  
  92.     <div class="top-day-stamp">
  93.       <xsl:call-template name="format-day-stamp">
  94.         <xsl:with-param name="stamp" select="//message[1]/@time"/>
  95.       </xsl:call-template>
  96.     </div>
  97.  
  98.     <xsl:for-each select="*">
  99.  
  100.       <xsl:variable name="prev-time">
  101.         <xsl:call-template name="get-day">
  102.           <xsl:with-param name="stamp" select="preceding-sibling::*[1]/@time"/>
  103.         </xsl:call-template>
  104.       </xsl:variable>
  105.  
  106.       <xsl:variable name="this-time">
  107.         <xsl:call-template name="get-day">
  108.           <xsl:with-param name="stamp" select="@time"/>
  109.         </xsl:call-template>
  110.       </xsl:variable>
  111.  
  112.       <xsl:if test="$prev-time < $this-time">
  113.         <div class="new-day-stamp">
  114.         <xsl:call-template name="format-day-stamp">
  115.           <xsl:with-param name="stamp" select="@time"/>
  116.         </xsl:call-template>
  117.         </div>
  118.       </xsl:if>
  119.  
  120.       <xsl:variable name="stamp">
  121.         <xsl:call-template name="format-stamp">
  122.           <xsl:with-param name="stamp" select="@time"/>
  123.         </xsl:call-template>
  124.       </xsl:variable>
  125.  
  126.       <span class="stamp">
  127.        <xsl:value-of select="$stamp"/>
  128.       </span>
  129.  
  130.       <xsl:variable name="nick-class">
  131.         <xsl:choose>
  132.           <xsl:when test="not(string(@id))">nick-self</xsl:when>
  133.           <xsl:otherwise>nick</xsl:otherwise>
  134.         </xsl:choose>
  135.       </xsl:variable>
  136.  
  137.       <span class="{$nick-class}">
  138.         <<xsl:value-of select="@name"/>>
  139.       </span>
  140.  
  141.       <xsl:apply-templates/>
  142.       <br/>
  143.  
  144.     </xsl:for-each>
  145.  
  146.   </xsl:template>
  147.  
  148. </xsl:stylesheet>
  149.